package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.Map;

@Mapper
public interface UserMapper {

    @Select("select * from user where openid=#{openid}")
    User getByUserId(String openid);


    void insert(User user);

    @Select("select * from user where id=#{id}")
    User getById(Long userId);

    @Select("select count(*) from user where create_time<#{endTime}")
    Integer getTotalUserStatistics(LocalDateTime endTime);

    /**
     * 根据条件统计套餐数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);

}
